package com.aspose.cells;

class zhe extends zhd {
   private Cells e;
   private int f;
   private int g;
   private Style h;
   private boolean i;
   private double j = -1.0D;

   public zhe(Cells var1, int var2, int var3, Style var4, boolean var5) {
      super(false);
      this.e = var1;
      this.f = var2;
      this.g = var3;
      this.h = var4;
      this.i = var5;
   }

   public double c() {
      if (this.j < 0.0D) {
         Range var1 = this.e.q().a(this.e, this.f, this.g);
         if (var1 == null) {
            this.j = this.e.getColumnWidth(this.g);
         } else {
            this.j = this.e.c.a(var1.getFirstColumn(), var1.getFirstColumn() + var1.getColumnCount() - 1);
         }
      }

      return this.j;
   }

   protected int a(String var1) {
      return this.h.getShrinkToFit() ? 11 : super.a(var1);
   }

   protected boolean d() {
      if (this.a == null) {
         if (this.i) {
            return true;
         } else {
            Style var1 = this.e.r().n().getDefaultStyle();
            Font var2 = var1.getFont();
            Style var3 = this.h;
            Font var4 = var3.q();
            if (var4 == null) {
               var3 = var3.getParentStyle();
               if (var3 == null || var3 == var1) {
                  return true;
               }

               var4 = var3.q();
               if (var4 == null) {
                  return true;
               }
            }

            if (var4.m() == var2.m() && com.aspose.cells.b.a.zv.b(var4.getName(), var2.getName())) {
               if (var4.getSize() == var2.getSize()) {
                  return true;
               } else {
                  this.a = new zrh(var2.getName(), var2.getSize(), var2.m(), com.aspose.cells.a.c.zn.a(var2.getName(), var2.m()));
                  this.e();
                  this.b = new zrh(var4.getName(), var4.getSize(), var4.m(), this.a.d());
                  this.f();
                  return false;
               }
            } else {
               this.a = new zrh(var2.getName(), var2.getSize(), var2.m(), true, (zrh)null);
               this.e();
               this.b = new zrh(var4.getName(), var4.getSize(), var4.m(), true, (zrh)null);
               this.f();
               return false;
            }
         }
      } else {
         if (this.b == null) {
            ;
         }

         return this.a.a(this.b);
      }
   }

   protected void b() {
      Font var1 = this.e.r().n().getDefaultStyle().getFont();
      if (this.b != null && this.b.c() == var1.m() && com.aspose.cells.b.a.zv.b(this.b.a(), var1.getName())) {
         if (this.b.b() == var1.getSize()) {
            this.a = this.b;
            this.e();
            return;
         }

         if (this.b.d() != null) {
            this.a = new zrh(var1.getName(), var1.getSize(), var1.m(), this.b.d());
            this.e();
            return;
         }
      }

      this.a = new zrh(var1.getName(), var1.getSize(), var1.m(), true, (zrh)null);
      this.e();
   }

   protected void a() {
      if (this.i) {
         if (this.a == null) {
            this.b();
         }

         this.b = this.a;
         this.f();
      } else {
         Style var1 = this.e.r().n().getDefaultStyle();
         Font var2 = var1.getFont();
         Style var3 = this.h;
         Font var4 = var3.q();
         if (var4 == null) {
            var3 = var3.getParentStyle();
            if (var3 == null || var3 == var1 || var3.q() == null) {
               if (this.a == null) {
                  this.b();
               }

               this.b = this.a;
               this.f();
               return;
            }

            var4 = var3.q();
         }

         if (var4.m() == var2.m() && com.aspose.cells.b.a.zv.b(var4.getName(), var2.getName())) {
            if (var4.getSize() == var2.getSize()) {
               if (this.a == null) {
                  this.b();
               }

               this.b = this.a;
               this.f();
            } else {
               this.a = new zrh(var2.getName(), var2.getSize(), var2.m(), com.aspose.cells.a.c.zn.a(var2.getName(), var2.m()));
               this.e();
               this.b = new zrh(var4.getName(), var4.getSize(), var4.m(), this.a.d());
               this.f();
            }
         } else {
            if (this.a == null) {
               this.a = new zrh(var2.getName(), var2.getSize(), var2.m(), true, (zrh)null);
               this.e();
            }

            this.b = new zrh(var4.getName(), var4.getSize(), var4.m(), true, (zrh)null);
            this.f();
         }
      }
   }
}
